package com.yonyougov.devops.cruxcisupport.rolebutton;

import com.yonyougov.devops.cruxcisupport.rolebutton.vo.RoleButtonPageLikeDto;
import com.yonyougov.devops.cruxcisupport.rolebutton.vo.RoleButtonPageLikeVo;
import com.yonyougov.devops.fwc.core.dao.impl.BaseDaoImpl;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;
import java.util.List;

/**
 * t_role_button数据层实现
 */
@Repository
public class RoleButtonDaoImpl extends BaseDaoImpl<RoleButtonEntity, BigInteger> implements RoleButtonDao {


    //<!--用户自定义代码开始-->

    private final SqlSessionTemplate sqlSessionTemplate;

    public RoleButtonDaoImpl(SqlSessionTemplate sqlSessionTemplate) {
        this.sqlSessionTemplate = sqlSessionTemplate;
    }

    @Override
    public List<RoleButtonPageLikeVo> findRoleButtonPageLike(RoleButtonPageLikeDto roleButtonPageLikeDto) {
        String statement = RoleButtonEntity.class.getName() + "Mapper.findRoleButtonPageLike";
        return sqlSessionTemplate.selectList(statement, roleButtonPageLikeDto);
    }

    @Override
    public int countByLikeRoleButton(RoleButtonPageLikeDto roleButtonPageLikeDto) {
        String statement = RoleButtonEntity.class.getName() + "Mapper.countByLikeRoleButton";
        return sqlSessionTemplate.selectOne(statement, roleButtonPageLikeDto);
    }

    @Override
    public void addBatch(List<RoleButtonEntity> roleButtonEntityList) {
        String statement = RoleButtonEntity.class.getName() + "Mapper.addBatch";
        sqlSessionTemplate.insert(statement, roleButtonEntityList);
    }

    @Override
    public void deleteBatchRoleButtonByIds(List<BigInteger> ids) {
        String statement = RoleButtonEntity.class.getName() + "Mapper.deleteBatchRoleButtonByIds";
        sqlSessionTemplate.insert(statement, ids);
    }
    //<!--用户自定义代码结束-->
}
